// pages/recommend/recommend.js
var api = require('../../utils/api.js');
Page({   
    data: {
        apipath: api.Apipath,
        flag: 0
    },
    changeColor1: function () {
        var that = this;
        that.setData({
            flag: 1
        });
    },
    changeColor2: function () {
        var that = this;
        that.setData({
            flag: 2
        });
    },
    changeColor3: function () {
        var that = this;
        that.setData({
            flag: 3
        });
    },
    changeColor4: function () {
        var that = this;
        that.setData({
            flag: 4
        });
    },
    changeColor5: function () {
        var that = this;
        that.setData({
            flag: 5
        });
    },
    
    callback:function(){
        wx.navigateBack({
            delta: 2
          })
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var that = this;
        that.setData({ doctorId: options.id });
        that.getDetails();
        wx.request({
          url: api.AppraiseList,
          data: { doctorId: options.id },
          method: 'GET',
          success: function (res) {
            that.setData({
              appraiseList: res.data.data//患者评价列表
            })
          },
        })
    },
    getDetails: function () {
      var that = this;
     
      var doctorId = that.data.doctorId;

      wx.showLoading({
        title: '加载中...',
        icon: 'loading',
        duration: 10000
      });
      wx.request({
        url: api.DoctorDetails,
        data: { doctorId: doctorId},
        method: 'GET',
        success: function (res) {
          console.log(res);
          wx.hideLoading();
          if (res.data.code == 200) {
              that.setData({
                doctorInfo: res.data.data,
              })
          }
        },
      })
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})